﻿/*-------------------------------------------------------------------------
* 命名空间: SiliconSelect.Converter/PassWordConverter
* 类       名: PassWordConverter
* 功      能:  TD
* 时      间:  2023/8/10 10:48:29
* 版      本:  V1.0
* 作      者:  Fioman
* 格      言:  Talk is cheap,show me the code ^_^
*-------------------------------------------------------------------------*/
using SiliconSelect.Base;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace SiliconSelect.Converter
{
    public class PassWordConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is string password)
            {
                if (GlobalValues.UserInfo!.Role == "工程师" || GlobalValues.UserInfo.Role == "管理员")
                    return password;
                return password.Replace(password, new string('*', password.Length));
            }
            return "";
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
